home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
CIncludes
/
DriverGestalt.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-01
|
16KB
|
403 lines
/*
File: DriverGestalt.h
Contains: Driver Gestalt interfaces
Version: Technology: System 7.5
Release: Universal Interfaces 3.0d3 on Copland DR1
Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
*/
#ifndef __DRIVERGESTALT__
#define __DRIVERGESTALT__
#ifndef __TYPES__
#include <Types.h>
#endif
#ifndef __OSUTILS__
#include <OSUtils.h>
#endif
#ifndef __SCSI__
#include <SCSI.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import on
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
#if FOR_SYSTEM7_ONLY
/*__________________________________________________________________________________*/
/* The Driver Gestalt bit in the dCtlFlags */
enum {
kbDriverGestaltEnable = 2,
kmDriverGestaltEnableMask = (1 << kbDriverGestaltEnable)
};
/*__________________________________________________________________________________*/
/* Driver Gestalt related csCodes */
enum {
kDriverGestaltCode = 43, /* various uses */
kDriverConfigureCode = 43, /* various uses */
kdgLowPowerMode = 70, /* Sets/Returns the current energy consumption level */
kdgReturnDeviceID = 120, /* returns SCSI DevID in csParam[0] */
kdgGetCDDeviceInfo = 121 /* returns CDDeviceCharacteristics in csParam[0] */
};
/*__________________________________________________________________________________*/
/* Driver Gestalt selectors */
enum {
kdgVersion = 'vers', /* Version number of the driver in standard Apple format */
kdgDeviceType = 'devt', /* The type of device the driver is driving. */
kdgInterface = 'intf', /* The underlying interface that the driver is using (if any) */
kdgSync = 'sync', /* True if driver only behaves synchronously. */
kdgBoot = 'boot', /* value to place in PRAM for this drive (long) */
kdgWide = 'wide', /* True if driver supports ioWPosOffset */
kdgPurge = 'purg', /* Driver purge permission (True = purge; False = no purge) */
kdgSupportsSwitching = 'lpwr', /* True if driver supports power switching */
kdgMin3VPower = 'pmn3', /* Minimum 3.3V power consumption in microWatts */
kdgMin5VPower = 'pmn5', /* Minimum 5V power consumption in microWatts */
kdgMax3VPower = 'pmx3', /* Maximum 3.3V power consumption in microWatts */
kdgMax5VPower = 'pmx5', /* Maximum 5V power consumption in microWatts */
kdgInHighPower = 'psta', /* True if device is currently in high power mode */
kdgSupportsPowerCtl = 'psup', /* True if driver supports following five calls */
kdgAPI = 'dAPI', /* API support for PC Exchange */
kdgEject = 'ejec' /* Eject options for shutdown/restart <2/03/95> */
};
/*__________________________________________________________________________________*/
/* status parameter block for Driver Gestalt calls */
struct DriverGestaltParam {
QElemPtr qLink;
short qType;
short ioTrap;
Ptr ioCmdAddr;
ProcPtr ioCompletion;
OSErr ioResult;
StringPtr ioNamePtr;
short ioVRefNum;
short ioCRefNum; /* refNum for I/O operation */
short csCode; /* == kDriverGestaltCode */
OSType driverGestaltSelector; /* 'sync', 'vers', etc. */
UInt32 driverGestaltResponse; /* Could be a pointer, bit field or other format */
UInt32 driverGestaltResponse1; /* Could be a pointer, bit field or other format */
UInt32 driverGestaltResponse2; /* Could be a pointer, bit field or other format */
UInt32 driverGestaltResponse3; /* Could be a pointer, bit field or other format */
UInt16 driverGestaltfiller; /* To pad out to the size of a controlPB */
};
typedef struct DriverGestaltParam DriverGestaltParam;
/*
Note that the various response definitions are overlays of the response fields above.
For instance the deviceType response would be returned in driverGestaltResponse.
The DriverGestaltPurgeResponse would be in driverGestaltResponse and driverGestaltResponse1
*/
/* GetDriverGestaltDevTResponse(gestaltPtr)->deviceType */
#define GetDriverGestaltDevTResponse(p) ((DriverGestaltDevTResponse *)(&((p)->driverGestaltResponse)))
#define GetDriverGestaltIntfResponse(p) ((DriverGestaltIntfResponse *)(&((p)->driverGestaltResponse)))
#define GetDriverGestaltPowerResponse(p) ((DriverGestaltPowerResponse *)(&((p)->driverGestaltResponse)))
#define GetDriverGestaltSyncResponse(p) ((DriverGestaltSyncResponse *)(&((p)->driverGestaltResponse)))
#define GetDriverGestaltBootResponse(p) ((DriverGestaltBootResponse *)(&((p)->driverGestaltResponse)))
#define GetDriverGestaltBootResponse(p) ((DriverGestaltBootResponse *)(&((p)->driverGestaltResponse)))
#define GetDriverGestaltPurgeResponse(p) ((DriverGestaltPurgeResponse *)(&((p)->driverGestaltResponse)))
#define GetDriverGestaltEjectResponse(p) ((DriverGestaltEjectResponse *)(&((p)->driverGestaltResponse)))
#define GetDriverGestaltVersionResponse(p) (((NumVersion*)(&((p)->driverGestaltResponse))))
#define GetDriverGestaltAPIResponse(p) ((DriverGestaltAPIResponse *)(&((p)->driverGestaltResponse)))
#define GetDriverGestaltBooleanResponse(p) ((Boolean *)(&((p)->driverGestaltResponse)))
/*__________________________________________________________________________________*/
/* Device Types response */
struct DriverGestaltDevTResponse {
OSType deviceType;
};
typedef struct DriverGestaltDevTResponse DriverGestaltDevTResponse;
enum {
kdgDiskType = 'disk', /* standard r/w disk drive */
kdgTapeType = 'tape', /* tape drive */
kdgPrinterType = 'prnt', /* printer */
kdgProcessorType = 'proc', /* processor */
kdgWormType = 'worm', /* write-once */
kdgCDType = 'cdrm', /* cd-rom drive */
kdgFloppyType = 'flop', /* floppy disk drive */
kdgScannerType = 'scan', /* scanner */
kdgFileType = 'file', /* Logical Partition type based on a file (Drive Container) */
kdgRemovableType = 'rdsk' /* A removable media hard disk drive ie. Syquest, Bernioulli */
};
/*__________________________________________________________________________________*/
/* Device Interfaces response */
struct DriverGestaltIntfResponse {
OSType interfaceType;
};
typedef struct DriverGestaltIntfResponse DriverGestaltIntfResponse;
enum {
kdgScsiIntf = 'scsi',
kdgPcmciaIntf = 'pcmc',
kdgATAIntf = 'ata ',
kdgFireWireIntf = 'fire',
kdgExtBus = 'card'
};
/*__________________________________________________________________________________*/
/* Power Saving */
struct DriverGestaltPowerResponse {
unsigned long powerValue; /* Power consumed in µWatts */
};
typedef struct DriverGestaltPowerResponse DriverGestaltPowerResponse;
/*__________________________________________________________________________________*/
/* Disk Specific */
struct DriverGestaltSyncResponse {
Boolean behavesSynchronously;
UInt8 pad[3];
};
typedef struct DriverGestaltSyncResponse DriverGestaltSyncResponse;
struct DriverGestaltBootResponse {
UInt8 extDev; /* Packed target (upper 5 bits) LUN (lower 3 bits) */
UInt8 partition; /* Unused */
UInt8 SIMSlot; /* Slot */
UInt8 SIMsRSRC; /* sRsrcID */
};
typedef struct DriverGestaltBootResponse DriverGestaltBootResponse;
struct DriverGestaltAPIResponse {
short partitionCmds; /* if bit 0 is nonzero, supports partition control and status calls */
/* prohibitMounting (control, kProhibitMounting) */
/* partitionToVRef (status, kGetPartitionStatus) */
/* getPartitionInfo (status, kGetPartInfo) */
short unused1; /* all the unused fields should be zero */
short unused2;
short unused3;
short unused4;
short unused5;
short unused6;
short unused7;
short unused8;
short unused9;
short unused10;
};
typedef struct DriverGestaltAPIResponse DriverGestaltAPIResponse;
/* Flags for purge permissions */
enum {
kbCloseOk = 0, /* Ok to call Close */
kbRemoveOk = 1, /* Ok to call RemoveDrvr */
kbPurgeOk = 2, /* Ok to call DisposePtr */
kmNoCloseNoPurge = 0,
kmOkCloseNoPurge = (1 << kbCloseOk) + (1 << kbRemoveOk),
kmOkCloseOkPurge = (1 << kbCloseOk) + (1 << kbRemoveOk) + (1 << kbPurgeOk)
};
/* Driver purge permission structure */
struct DriverGestaltPurgeResponse {
UInt16 purgePermission; /* 0 = Do not change the state of the driver */
/* 3 = Do Close() and DrvrRemove() this driver */
/* but don't deallocate driver code */
/* 7 = Do Close(), DrvrRemove(), and DisposePtr() */
UInt16 purgeReserved;
Ptr purgeDriverPointer; /* pointer to the start of the driver block (valid */
/* only of DisposePtr permission is given */
};
typedef struct DriverGestaltPurgeResponse DriverGestaltPurgeResponse;
struct DriverGestaltEjectResponse {
UInt32 ejectFeatures; /* */
};
typedef struct DriverGestaltEjectResponse DriverGestaltEjectResponse;
/* Flags for Ejection Features field */
enum {
kRestartDontEject = 0, /* Dont Want eject during Restart */
kShutDownDontEject = 1, /* Dont Want eject during Shutdown */
kRestartDontEject_Mask = 1 << kRestartDontEject,
kShutDownDontEject_Mask = 1 << kShutDownDontEject
};
/*__________________________________________________________________________________*/
/* CD-ROM Specific */
/*
The CDDeviceCharacteristics result is returned in csParam[0] and csParam[1] of a
standard CntrlParam parameter block called with csCode kdgGetCDDeviceInfo.
*/
struct CDDeviceCharacteristics {
UInt8 speedMajor; /* High byte of fixed point number containing drive speed */
UInt8 speedMinor; /* Low byte of "" CD 300 == 2.2, CD_SC == 1.0 etc. */
UInt16 cdFeatures; /* Flags field for features and transport type of this CD-ROM */
};
typedef struct CDDeviceCharacteristics CDDeviceCharacteristics;
enum {
cdFeatureFlagsMask = 0xFFFC, /* The Flags are in the first 14 bits of the cdFeatures field */
cdTransportMask = 0x0003 /* The transport type is in the last 2 bits of the cdFeatures field */
};
/* Flags for CD Features field */
enum {
cdMute = 0, /* The following flags have the same bit number */
cdLeftToChannel = 1, /* as the Audio Mode they represent. Don't change */
cdRightToChannel = 2, /* them without changing dControl.c */
cdLeftPlusRight = 3, /* Reserve some space for new audio mixing features (4-7) */
cdSCSI_2 = 8, /* Supports SCSI2 CD Command Set */
cdStereoVolume = 9, /* Can support two different volumes (1 on each channel) */
cdDisconnect = 10, /* Drive supports disconnect/reconnect */
cdWriteOnce = 11, /* Drive is a write/once (CD-R?) type drive */
cdMute_Mask = 1 << cdMute,
cdLeftToChannel_Mask = 1 << cdLeftToChannel,
cdRightToChannel_Mask = 1 << cdRightToChannel,
cdLeftPlusRight_Mask = 1 << cdLeftPlusRight,
cdSCSI_2_Mask = 1 << cdSCSI_2,
cdStereoVolume_Mask = 1 << cdStereoVolume,
cdDisconnect_Mask = 1 << cdDisconnect,
cdWriteOnce_Mask = 1 << cdWriteOnce
};
/* Transport types */
enum {
cdCaddy = 0, /* CD_SC,CD_SC_PLUS,CD-300 etc. */
cdTray = 1, /* CD_300_PLUS etc. */
cdLid = 2 /* Power CD - eg no eject mechanism */
};
/*
the following are used by PC Exchange (and houdini)
Control Codes
*/
enum {
kRegisterPartition = 50, /* PCX needs a new Drive (for a non-macintosh partition found on the disk)*/
OLD_REGISTER_PARTITION = 301, /* left in for compatibility with shipping Houdini*/
THE_DRIVE = 0, /* DrvQElPtr for the partition to register*/
THE_PHYS_START = 1, /* The start of the partition in logical blocks*/
THE_PHYS_SIZE = 2, /* The size of the partition in logical blocks*/
kGetADrive = 51, /* control call to ask the driver to create a drive*/
OLD_GET_A_DRIVE = 302, /* left in for compatibility with shipping Houdini*/
THE_VAR_QUEL = 0, /* a VAR parameter for the returned DrvQElPtr*/
kProhibitMounting = 52, /* Dont allow mounting of the following drives*/
kOldProhibitMounting = 2100, /* left in for compatibility with shipping Houdini*/
kProhibitDevice = 0, /* CS Param 0 and 1 (partInfoRecPtr)*/
kIsContainerMounted = 53,
kOldIsContainerMounted = 2201, /* left in for compatibility with shipping Houdini */
kContainerVRef = 0, /* CS Param 0 and 1 (VRefNum)*/
kContainerParID = 1, /* CS Param 2 and 3 (Parent ID)*/
kContainerName = 2, /* CS Param 4 and 5 (File Name)*/
kContainerResponse = 3, /* CS Param 6 and 7 (VAR pointer to short result)*/
kMountVolumeImg = 54,
OLD_MOUNT_VOLUME_IMG = 2000,
MV_HOST_VREFNUM = 0,
MV_HOST_PAR_ID = 1,
MV_HOST_NAME = 2,
MV_REQ_PERM = 3
};
/* Status Codes*/
enum {
kGetPartitionStatus = 50, /* what is the status of this partition?*/
kOldGetPartitionStatus = 2200, /* left in for compatibility with shipping Houdini*/
kDeviceToQuery = 0, /* CS Param 0 and 1 (partInfoRecPtr)*/
kDeviceResponse = 1, /* CS Param 2 and 3 (VAR pointer to short result)*/
kGetPartInfo = 51, /* Get a partition info record based on the provided vrefnum*/
kOldGetPartInfo = 2300, /* left in for compatibility with shipping Houdini*/
kPartInfoResponse = 0, /* var parameter (pointer to partInfoRec) CSParam [0-1]*/
kGetContainerAlias = 52, /* Get the alias that describes the file this drive was mounted from.*/
kOldGetContainerAlias = 2400, /* left in for compatibility with shipping Houdini*/
kGetAliasResponse = 0 /* var parameter (pointer to a Handle) CSParam [0-1]*/
};
/* the result codes to come from the driver interface */
enum {
DRIVER_NOT_INSTALLED = -1,
DRIVER_BUSY = -2,
CANT_MOUNT_WITHIN_THIS_FS = -3, /* can only mount container within residing on HFS volume*/
VOLUME_ALREADY_MOUNTED = -4 /* Already Mounted*/
};
/* requisite structures for PCX control and status calls*/
enum {
kMaxProhibted = 2 /* the max number of volumes the PC can possibly have mounted*/
};
/* GestaltSelector for Finding Driver information*/
enum {
kGetDriverInfo = 'vdrc'
};
enum {
VerifyCmd = 5,
FormatCmd = 6,
EjectCmd = 7
};
/* Partition information passed back and forth between PCX and the driver*/
struct partInfoRec {
DeviceIdent SCSIID; /* DeviceIdent for the device*/
UInt32 physPartitionLoc; /* physical block number of beginning of partition*/
UInt32 partitionNumber; /* the partition number of this partition*/
};
typedef struct partInfoRec partInfoRec;
typedef partInfoRec *partInfoRecPtr;
struct vPartInfoRec {
UInt8 VPRTVers; /* Virtual partition version number*/
UInt8 VPRTType; /* virtual partition type (DOS, HFS, etc)*/
SInt16 drvrRefNum; /* Driver Reference number of partition driver*/
};
typedef struct vPartInfoRec vPartInfoRec;
typedef vPartInfoRec *vPartInfoRecPtr;
/* Information related to DOS partitions*/
enum {
kDOSSigLow = 0x01FE, /* offset into boot block for DOS signature*/
kDOSSigHi = 0x01FF, /* offset into boot block for DOS signature*/
kDOSSigValLo = 0x55, /* DOS signature value in low byte*/
kDOSSigValHi = 0xAA /* DOS signature value in high byte*/
};
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import off
#endif
#ifdef __cplusplus
}
#endif
#endif /* __DRIVERGESTALT__ */